package com.wf.mock.app.mina.app.processor.impl;

import lombok.extern.log4j.Log4j;

import org.apache.mina.core.session.IoSession;

import com.wf.mock.app.mina.RetrySendMsgManager;
import com.wf.mock.app.mina.app.processor.IMessageProcessor;
import com.wf.mock.app.mina.dto.ConfirmMsgDTO.ConfirmState;
import com.wf.mock.app.mina.dto.RawMessageDTO;

@Log4j
public class MinaConfirmMessageProcessorImpl implements IMessageProcessor {

	@Override
	public void process(RawMessageDTO msgDto, IoSession session) {
		log.debug("userId : " + session.getAttribute("userId") + ",mesagge:" + msgDto);

		if (ConfirmState.SUCCESS == ConfirmState.valueOf(msgDto.getMsgBody().getString("state"))) {
			String markId = msgDto.getMsgMarkId();
			RetrySendMsgManager.INSTANCE.removeEvent(markId);
		} else {
			// System.exit(0);
		}

	}

}
